(function ($) {
    $.extend({
      formatDate: function (message) {
        var now = new Date(), //初始化一个日期对象
          y = now.getFullYear(), // 获取年份
          m =
            now.getMonth() + 1 >= 10
              ? now.getMonth() + 1
              : "0" + (now.getMonth() + 1),
          // JavaScript中月份是从0开始的，稍作处理！(0-11)
          d = now.getDate() >= 10 ? now.getDate() : "0" + now.getDate(),
          // 获取日期 (1-31)  小于10 显示0n
          day = now.getDay(), // 获取星期几 (0-6) 0:星期日
          h = now.getHours(), // 获取小时
          min = now.getMinutes(), //获取分钟
          s = now.getSeconds(); //获取秒
        var time =
          y +
          "-" +
          m +
          "-" +
          d +
          " " +
          "星期" +
          day +
          " " +
          h +
          ":" +
          min +
          ":" +
          s;
        return time + " 是时候" + message;
      },
    });
})(jQuery);
